import VueRouter from 'vue-router'
import HomeContainer from './../components/tabbar/HomeContainer.vue'
import MemberContainer from './../components/tabbar/MemberContainer'
import ShopcarContainer from './../components/tabbar/ShopcarContainer'
import SearchContainer from './../components/tabbar/SearchContainer'
import NewsList from './../components/news/NewsList.vue'
import NewsInfo from "./../components/news/NewsInfo.vue"
import PhotoList from './../components/photos/PhotoList.vue'
import PhotoInfo from './../components/photos/PhotoInfo'
import GoodsList from './../components/goods/GoodsList'
import GoodsInfo from './../components/goods/GoodsInfo'
import GoodsDesc from './../components/goods/GoodsDesc';
import GoodsInfoCommnent from '../components/goods/GoodsInfoComment'

// 创建路由对象
var router = new VueRouter({
    // 1: 配置路由对象
    routes: [ 
        // 指定根路径
        {
            path: '/', 
            redirect: '/home' 
        },
        {
            // 1:路由路径
            path: "/home",
            // 2：路由组件
            component: HomeContainer
        },
        {
            // 1:路由路径
            path: "/member",
            // 2：路由组件
            component: MemberContainer
        },
        {
            // 1:路由路径
            path: "/shopcar",
            // 2：路由组件
            component: ShopcarContainer
        },
        {
            // 1:路由路径
            path: "/search",
            // 2：路由组件
            component: SearchContainer
        },
        {
            // 1:路由路径
            path: "/home/newslist",
            // 2：路由组件
            component: NewsList
        },
        {
            /*
            1:路由路径  传递参数
            /home/newsinfo/:id  
            $route.params.id   来 获取id的值
            用？传递的值：用query 来接受  $route.query.id 来获取
            */ 
            path: "/home/newsinfo/:id",
            // 2：路由组件
            component: NewsInfo
        },
        {
            path: "/home/photolist",
            component: PhotoList
        },
        {
            path: "/home/photoinfo/:id",
            component: PhotoInfo
        },
        {
            path: "/home/goodslist",
            component: GoodsList
        },
        {
            path: "/home/goodsinfo/:id",
            component: GoodsInfo,
            name: "goodsinfo" // 指定路由的名字，可以用命名路由方式进行跳转，这里的name 不是路由的名字，是路由规则的名字
        },
        {
            path: "/home/goodsdesc/:id",
            component: GoodsDesc,
            name: "GoodsDesc" // 指定路由的名字，可以用命名路由方式进行跳转，这里的name 不是路由的名字，是路由规则的名字
        },
        {
            path: "/home/goodsinfocomment/:id",
            component: GoodsInfoCommnent,
            name: "GoodsInfoCommnent" // 指定路由的名字，可以用命名路由方式进行跳转，这里的name 不是路由的名字，是路由规则的名字
        }
        
        
    ],
    // 2: 覆盖默认的路由高亮的类，默认的类叫做  router-link-active
    linkActiveClass: 'mui-active'

});

// 把路由器对象暴露出去
export default router